package com.bosssoft.hr.train.j2se.collection;

import com.bosssoft.hr.train.j2se.pojo.entity.User;

import java.util.*;

/**
 * TreeSet存储是个对象，输入数据是按编号升序输入，输出时按编号降序输出
 *
 * @author 史旭升
 * @date 2022-12-06 23:57
 */
public class TreeSetDemo {

    /**
     * main方法
     *
     * @param args
     * @return void
     * @author shi xusheng
     * @date 2022/12/07 13:44
     */
    public static void main(String[] args) {
        Set<User> userTreeSet = new TreeSet<>();
        int num = 10;
        User[] users1 = new User[num];
        for(int i=0;i<num;i++){
            userTreeSet.add(new User(
                    new Long(i),
                    "史旭升" + i
            ));

    }
        Iterator<User> userIterator=userTreeSet.iterator();
        while (userIterator.hasNext()){
            System.out.println(userIterator.next().toString());
        }
    }
    }



